﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.MovieRecorder.CUiMRCRibbonBarRecorderSwitchButton
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EngineeringInternalExtension;
using System;
using System.Drawing;
using System.Windows;


namespace DnProcessSimulateCommands.MovieRecorder;

internal class CUiMRCRibbonBarRecorderSwitchButton : CUiMRCRibbonBarRecorderButton
{
  private Bitmap m_icon2;
  private string m_tooltip2;
  private bool m_toggle;

  public CUiMRCRibbonBarRecorderSwitchButton(
    Tuple<string, string> tooltipImagePair1,
    Tuple<string, string> tooltipImagePair2)
    : base(tooltipImagePair1.Item1, tooltipImagePair1.Item2)
  {
    this.m_icon2 = Image.FromStream(Application.GetResourceStream(new Uri(tooltipImagePair2.Item2, UriKind.RelativeOrAbsolute)).Stream) as Bitmap;
    this.m_tooltip2 = tooltipImagePair2.Item1;
  }

  protected override IntPtr GetButtonIcon()
  {
    return this.m_toggle ? this.GetIcon(this.m_icon2) : this.GetIcon(this.m_icon);
  }

  public virtual string Tooltip
  {
    get => this.m_toggle ? this.m_tooltip2 : this.m_tooltip;
    protected set
    {
    }
  }

  public override void OnClick()
  {
    this.m_toggle = !this.m_toggle;
    this.PostUpdateRequest();
    TxRibbonToolGroupBarManagerEx.ForceUpdateToolGroupBar(this.ToolGroupBar);
    base.OnClick();
  }

  internal override void ResetContent()
  {
    this.m_toggle = false;
    this.PostUpdateRequest();
  }
}
